Repository navigation
fix(hooks): let Stop continue false finish the turn - #41
Conversation
Claude Code treats continue false as a full stop and gives it precedence over a Stop decision. hookBlock still reports that value as a block for pre-tool and prompt hooks, but finalization turned every Stop block into revise, so a finished hook sent the agent back to work. A Stop hook with decision block still revises. A hook that sets both continue false and decision block finalizes. The registered finalizer covers both Stop outputs. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 5:35 AM ET / 09:35 UTC (Revision 3). ClawSweeper reviewWhat this changesBabelfish lets imported Stop hooks finish a turn when they return Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. Both prior review blockers are resolved: README documents the precedence, and the maintainer explicitly accepted the upgrade behavior. No actionable introduced defect remains. Priority: P2 Review scores
Verification
How this fits togetherBabelfish translates imported Claude Code and Codex hook results into OpenClaw lifecycle decisions. Its finalization handler determines whether a turn can finish or needs another revision. flowchart TD
A[OpenClaw turn finalization] --> B[Run imported Stop hooks]
B --> C[Collect hook results]
C --> D[Exclude results with continue false]
D --> E{Remaining blocking result}
E -->|Yes| F[Request revision]
E -->|No| G[Allow finalization]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep finalization precedence local to each Stop result while preserving independent revision guards and existing prompt/tool blocking. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main maps a Stop result containing continue:false through hookBlock into revision. The recorded production-handler run verifies the repaired result; this read-only review did not execute tests. Is this the best way to solve the issue? Yes. Filtering only the finalizer's individual continue:false results repairs completion without changing shared blocking semantics or suppressing separate guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5fdda0b28cf6. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
| for (const [index, result] of decisions.entries()) { | ||
| await fs.writeFile( | ||
| path.join(pluginRoot, `hook-${index}.mjs`), | ||
| `process.stdin.resume(); process.stdin.on("end", () => { console.log(${JSON.stringify(JSON.stringify(result))}); process.exitCode = ${options.exitCode ?? 0}; });`, |
|
@clawsweeper re-review Exact candidate Registered-handler proof includes same-hook precedence, conflicting hooks in |
|
🦞👀 Re-review progress:
|
Summary
continue: falseno longer requests another pass.docs/compatibility.md, plus registered-handler regression coverage.Compatibility And Maintainer Decision
before_agent_finalize.continue: falsefinish the turn after upgrade instead of requesting revision.
continue: falseoutranks a blockon that same result. A separate blocking result still requests revision,
regardless of hook order.
prompt handling still treat
continue: falseas blocking.ownership change. Shared
hookBlocksemantics remain unchanged.The earlier PR description incorrectly said README had no compatibility table.
It does; its table is now updated. The owner explicitly accepted this upgrade
behavior in the reviewed 0.1.1 campaign scope on October 1, 2026.
Verification
Exact candidate:
6381d6c1697ded3921a431a0eca16e248286f3ea.Original contributor head:
a66b5fda0cbcbc3846fd6ace378d039cea221888.src/index.test.tsandsrc/bundle-plugins.test.ts: 54 passed.npm run check: build and 144 tests passed across 11 files.npm run pack:check: 24 files, 279628 bytes unpacked.6381d6c.Main was integrated only after #43's squash merge caused a real changelog
conflict. Both credited changelog entries are retained; no contributor history
was rewritten.
Real Behavior Proof
Executed on October 1, 2026, Node 26.8.1 / npm 11.19.1 / Python 3.14.6 /
macOS arm64. Tests register the production Babelfish entry with isolated
plugin state and invoke its actual registered handlers. Temporary command
hooks execute through the process supervisor.
continue:falseundefined)decision:"block"action:"revise"with reason/retrycontinue:falsecontinue:falseThis is registered-handler/process proof, not a claim of a live Gateway session.
Original contribution and history retained. Thanks @SebTardif.